let path = require('path');
let HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {

  mode: "development",// development:开发环境  production: 生产环境 压缩
  entry: {
    'page1':'./src/main.js',
    'page2':'./src/index2.js'
  },
  output: {
    filename: "[name]-bundle.js",
    path: path.join(__dirname, './dist')
  },
  devServer: {
    port: 3000,
    compress: true,//Gzip压缩
    // contentBase:'./dist'//设置静态资源路径
  },
  plugins: [
    new HtmlWebpackPlugin({
      filename: 'bundle1.html',
      template: path.join(__dirname, './index.html'),
      chunks:['page1']
    }),
    new HtmlWebpackPlugin({
      filename: 'bundle2.html',
      template: path.join(__dirname, './index2.html'),
      chunks:['page2']
    })

  ]
};
